﻿using System;
using System.Collections.Generic;
using System.Text;
using PPAP.DAO;
using System.Data;
using PPAP.Model;

namespace PPAP.BO
{
    public class UsersBO
    {
        public UsersBO() { }
        UsersDAO dao = new UsersDAO();

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Users model)
        {
            return dao.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(Users model)
        {
            return dao.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(int id)
        {
            return dao.Delete(id);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Users GetModel(int id)
        {
            return dao.GetModel(id);
        }

        /// <summary>
        /// 得到一个对象实体 根据用户名
        /// </summary>
        public Users GetModelByUserName(string username)
        {
            return dao.GetModelByUserName(username);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dao.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList()
        {
            return dao.GetList();
        }

        /// <summary>
        /// 获得指定国家的TM
        /// </summary>
        /// <param name="country"></param>
        /// <returns></returns>
        public DataSet GetListForCountry(string country)
        {
            return dao.GetListForCountry(country);
        }

        /// <summary>
        /// 验证邮箱在系统中是否存在  包括后台用户，供应商联系人
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public bool CheckEamil(string email)
        {
            return dao.CheckEamil(email);
        }

        /// <summary>
        /// 验证管理员邮箱是否已在其他表中存在
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public bool CheckEmailNotAdmin(string email)
        {
            return dao.CheckEmailNotAdmin(email);
        }

        /// <summary>
        /// 获取所有Q-VP的EMAIL
        /// </summary>
        /// <returns></returns>
        public DataTable GetVPEmail(string country)
        {
            return dao.GetVPEmail(country);
        }

        /// <summary>
        /// 获取所有qe
        /// </summary>
        /// <returns></returns>
        public DataSet GetQE()
        {
            return dao.GetQE();
        }

        /// <summary>
        /// 判断用户是否具有admin权限
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public bool IsAdmin(string username)
        {
            return dao.IsAdmin(username);
        }

        /// <summary>
        /// 判断用户是否是德国人
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public bool IsGermany(string username)
        {
            return dao.IsGermany(username);
        }
    }
}
